package com.koron.css2.electronicCred.impl;

import com.koron.css2.ServerInterface;
import com.koron.css2.serviceManage.bean.RequestBean;
import com.koron.css2.serviceManage.bean.UserInfoBean;
import com.koron.util.Constant;
import com.koron.util.GovServicesReqUtils;
import com.koron.util.JsonUtils;
import org.koron.ebs.mybatis.SessionFactory;
import org.swan.bean.MessageBean;


/**
 * 张涛
 * 2023/03/17
 *
 * 企业用户查询法人空间工单信息
 */
public class GetWorkOrderInfo implements ServerInterface {

    @Override
    public MessageBean<?> exec(SessionFactory factory, UserInfoBean userInfo, RequestBean req) {
        try {
            MessageBean<?> messageBean1 =JsonUtils.jsonToPojo(GovServicesReqUtils.doPostToGovServices("/workOrderCallback", req.getData()), MessageBean.class);
            if (messageBean1.getCode()==Constant.MESSAGE_INT_SUCCESS && messageBean1.getData()!=null){
                //工单详情数据未返回，如有需要，返回data即可
                return MessageBean.create(Constant.MESSAGE_INT_SUCCESS,"用户已扫码授权!",String.class);
            }else {
                return MessageBean.create(Constant.MESSAGE_INT_FAIL,messageBean1.getDescription(),String.class);
            }
        }catch (Exception e){
            return MessageBean.create(Constant.MESSAGE_INT_FAIL,"查询工单信息失败",String.class);
        }
    }
}
